package com.atguigu.study.controller;

import dev.langchain4j.model.chat.ChatLanguageModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther zzyy
 * @create 2025-03-11 17:47
 */
@RestController
@Slf4j
public class ChatLanguageModelController
{
    @Resource
    private ChatLanguageModel chatLanguageModel;

    // http://localhost:9003/chatconfig/config
    @GetMapping(value = "/chatconfig/config")
    public String hello(@RequestParam(value = "prompt", defaultValue = "你是谁") String prompt)
    {
        String result = chatLanguageModel.generate(prompt);

        System.out.println("通过langchain4j调用qwen-turbo-0624模型返回结果："+result);

        return result;
    }
}
